home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / GRAPHICS / RAYTRACE.ZIP / LOADPCX.H < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-27  |  1.2 KB  |  61 lines

  1. #ifndef _LOADPCX_H
  2.     #define _LOADPCX_H
  3.  
  4. /*    Header info extracted from USUAL.H: */
  5.  
  6. typedef int bool;
  7.  
  8. /*    Boolean values */
  9.  
  10. #define TRUE    1
  11. #define FALSE    0
  12.  
  13. /*    Assembly variable terms */
  14.  
  15. #define byte unsigned char
  16. #define word unsigned short
  17. #define dword unsigned long
  18.  
  19. /*-------- end 'USUAL.H'-------- */
  20.  
  21.  
  22. /*    VGA's palette structure    */
  23.  
  24. struct VgaPalette
  25. {
  26.     byte red,green,blue;
  27. };
  28.  
  29. /*    Simple structure to hold the decoded PCX image and data */
  30.  
  31. struct PcxPix
  32. {
  33.     word width,height;
  34.     byte *image;
  35. };
  36.  
  37. /*    load_pcx return values */
  38.  
  39. enum {
  40.     pcx_ok = 0,
  41.     pcx_invalid, /* not a valid 256-color PCX file */
  42.     pcx_nomem,   /* ran out of memory */
  43.     pcx_ferror,  /* file error occured */
  44.     pcx_openerr  /* file error on open */
  45. };
  46.  
  47. /*    256-color PCX load Function:
  48. **
  49. **    Decodes a PCX file, placing the info (and image) into 'pix'
  50. **    It places the PCX file's 256-color palette into 'pal'
  51. **
  52. **    NOTE: pix->image will be dynamically allocated (via farmalloc), and
  53. **    must be deleted (via farfree) by the caller
  54. */
  55.  
  56. extern int load_pcx(const char * name,
  57.                     struct PcxPix * pix,
  58.                     struct VgaPalette * pal);
  59.  
  60. #endif    /* _LOADPCX_H */
  61.